$(function () {
    $.ajax({
        url: "./goSHGL/initPage", //请求的url地址
        xhrFields: {
            withCredentials: true
        },
        dataType: "json", //返回格式为json
        type: "GET", //请求方式
        processData: false, //对表单data数据是否进行序列化
        contentType: false, //dataType设置你收到服务器数据的格式
        headers: {
            'Content-Type': 'application/json'
        },
        beforeSend: function() {
            //请求前的处理
        },
        success: function(data) {
            if(data.status==0){
                // top.location.href = "../../login.html";
                window.location.href="./login.html";
            }else{
                var dataj = JSON.parse(data.data);
                var lim = dataj.lim;
                if(lim=="0"){
                    $("#SHLim").attr("style","")
                    $("#CPLim").attr("style","")
                    $("#SQLim").attr("style","")
                }else if(lim=="-1"){
                    window.location.href="./login.html";
                }else if(lim=="1"||lim=="11"){
                    $("#SHLim").attr("style","")
                }else if(lim=="2"||lim=="21"){
                    $("#CPLim").attr("style","")
                }else{
                    window.location.href="./login.html";
                }
                document.getElementById("uname1").innerText = data.username;
                document.getElementById("userno1").innerText = data.userno;
            }
        },
        complete: function() {
            //请求完成的处理
        },
        error: function() {}
    });
})